package scuba.DiveBuddy;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import scuba.DiveBuddy.Adapters.HistoryEntriesArrayAdapter;
import scuba.DiveBuddy.Class.LogEntries;
import scuba.DiveBuddy.Class.LogEntry;

import java.util.ArrayList;

/**
 * @author Alex Anderson
 * @version 1.0
 * @since {10/04/2014}
 */
public class HistoryActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_history);
        ListView v = (ListView)findViewById(R.id.historyView);

        ArrayList<LogEntry> logs = LogEntries.getInstance().getEntries();
        HistoryEntriesArrayAdapter a = new HistoryEntriesArrayAdapter(this,
                logs.toArray(new LogEntry[logs.size()]));

        v.setAdapter(a);
    }
}